﻿/*
 * Erstellt mit SharpDevelop.
 * Benutzer: EHWWDRE
 * Datum: 06.09.2010
 * Zeit: 15:36
 * 
 * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
 */
using System;
using System.Data;

using Spring.Data.Generic;

namespace export.Database
{
	/// <summary>
	/// Description of CptasklistRowMapper.
	/// </summary>
	public class CptasklistRowMapper<T> : IRowMapper<T> where T : Cptasklist, new()
	{
		public T MapRow(IDataReader dataReader, int rowNum)
		{	
			for (int i = 0; i < dataReader.FieldCount; i++)
			{
				Console.WriteLine("Column Index: " + i);
				Console.WriteLine("Type Name:  " + dataReader.GetDataTypeName(i));
				Console.WriteLine("Field Type: " + dataReader.GetFieldType(i));
				//Console.WriteLine("Field Type: " + dataReader.GetSchemaTable().TableName);
			}

			T cptasklist = new T();
			cptasklist.Id = dataReader.GetInt64(0);
			/*
			cptasklist.Stichmon = dataReader.GetInt32(1);
			cptasklist.Fullname = dataReader.GetString(2);
			cptasklist.Uploadtype = dataReader.GetInt32(3);
			cptasklist.Status = dataReader.GetInt32(4);
			cptasklist.Created = dataReader.GetDateTime(5);
			cptasklist.CreatedForm = dataReader.GetString(6);
			if (!dataReader.IsDBNull(7))
			{
				cptasklist.Released = dataReader.GetDateTime(7);
				cptasklist.ReleasedFrom = dataReader.GetString(8);
			}

			if (!dataReader.IsDBNull(9))
			{
				cptasklist.Deleted = dataReader.GetDateTime(9);
				cptasklist.DeletedFrom = dataReader.GetString(10);
			}

			if (!dataReader.IsDBNull(11))
			{
				cptasklist.NumRows = dataReader.GetInt64(11);
				cptasklist.NumErrors = dataReader.GetInt64(12);
				cptasklist.NumSuccess = dataReader.GetInt64(13);
			}
			*/
			return cptasklist;
		}
	}
}
